﻿using System;

using Wicresoft.Framework.Organization;
using MaLu.BusiLogic;
using MaLu.Common;
using System.Data;
using MaLu.Data;
using System.Xml;
using MaLu.Framework.Common;


namespace MaluJg.web.Visite
{
    public partial class item1v : VisitePage1
    {
        public Guid DepartmentID
        {
            get
            {
                if (Request["DepartmentID"] != null)
                    return new Guid(Request["DepartmentID"]);
                return Guid.NewGuid();
            }
        }



        protected void Page_Load(object sender, EventArgs e)
        {
            tbStart.Attributes.Add("readonly", "readonly");
            tbEnd.Attributes.Add("readonly", "readonly");

            if (!IsPostBack)
            {
                if (VisiteID != Guid.Empty)
                {

                    DataTable dt = SqlHelper.Instance.ExecuteDataTable(Provider, "select * from Visite where id ='" + VisiteID.ToString() + "'");
                    if (dt.Rows.Count > 0)
                    {
                        tbName.Text = dt.Rows[0]["Leader"].ToString();
                        tbRemark.Text = dt.Rows[0]["Remark"].ToString();
                        tbContact.Text = dt.Rows[0]["Contact"].ToString();
                        tbVisitee.Text = dt.Rows[0]["Interviewee"].ToString();
                        if (dt.Rows[0]["ArrangeStartTime"].ToString() !=string.Empty)
                        {
                            tbStart.Text = DateTime.Parse(dt.Rows[0]["ArrangeStartTime"].ToString()).ToString("yyyy-MM-dd");
                            
                        }
                        if (dt.Rows[0]["ArrangeEndTime"].ToString() != string.Empty)
                        {
                            tbEnd.Text = DateTime.Parse(dt.Rows[0]["ArrangeEndTime"].ToString()).ToString("yyyy-MM-dd");
                            
                        }
                    }
                }
            }
        }
       
    }
}
